import Vue from 'vue'
import Vuex from 'vuex'
import logger from "vuex/dist/logger"
import persistedstate from "vuex-persistedstate"
import userModules from './modules/userModules'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list:{},
    flag:false,
    age:12
  },
  mutations: {
    asyncSetList(state,payload){
      state.list=payload
    },
    setFlage(state, payload) {
      state.flag = payload
    }
  },
  getters:{
    showNum(state) {
      return !state.flag
    }
  },
  actions: {
    setList(context,payload){
      console.log(context,"state");
      console.log(payload,"payload");
      context.commit("asyncSetList",payload)
    }
  },
  modules: {
    userModules
  },
  plugins:[logger(),persistedstate()]
})
